package com.netbetter.langzheng.plugin.fileManager.context;

import com.extjs.gxt.ui.client.mvc.Dispatcher;
import com.netbetter.langzheng.commons.constants.AppEvents;
import com.netbetter.langzheng.plugin.fileManager.model.FileModel;

/**
 * @author 嘉陵江里捉鱼 email:tang7259@163.com
 *@version 1.0
 *@time 2008-9-11 下午11:22:12
 */
public class CutFileEventContext {

    /**
     * 当前节点FileModel对象
     */
    protected static FileModel fileModel;
    /**
     * 当前路径
     */
    private static String      currentPath;

    public static String getCurrentPath() {
        return currentPath;
    }

    public static FileModel getFileModel() {
        return fileModel;
    }

    private static FileModel parentFileModel;

    public static FileModel getParentFileModel() {
        return parentFileModel;
    }

    /**
     * 对fileModel进行清理操作
     */
    public static void cleanUp() {
        fileModel = null;
    }

    public static void attach(FileModel fileModel) {
        CutFileEventContext.fileModel = fileModel;
        CutFileEventContext.parentFileModel = ChangeTreeItemEventContext.getFileModel();// 将父亲节点记录下
        CutFileEventContext.currentPath = EventUtils.getCurrentFullPath() + fileModel.getName();
        Dispatcher.forwardEvent(AppEvents.CutFile);
    }
}
